﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.Collections;

#endregion

namespace ScrumTable.BL.DM.DataManagement
{
    /// <summary>
    /// This class specifies the base interface for all domain data
    /// collections.
    /// </summary>
    /// <remarks>
    /// This is an internal interface and is used to provide some non-typed
    /// informations about a domain collection.
    /// </remarks>
    internal interface IDomainCollection : ICollection, IDisposable
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets the type which corresponds to the domain object types
        /// of the current collection.
        /// </summary>
        Type ItemType { get; }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Checks wheter the element with the given id is contained
        /// in the current collection.
        /// </summary>
        /// <value>Returns true, if an element with the given id exists in the
        /// current collection.</value>
        bool ContainsId(string id);

        /// <summary>
        /// Releases the internal data and refreshes the data storage.
        /// </summary>
        /// <param name="deep">True to (re)load the children of the curent domain collection.</param>
        void LoadData(bool deep);

        /// <summary>
        /// Releases the internal data and refreshes the data storage.
        /// </summary>
        /// <param name="deep">True to (re)load the children of the curent domain collection.</param>
        /// <param name="callback">Specifies the asynchronous callback delegate. The callback value is of type DataResult.</param>
        void LoadDataAsync(bool deep, AsyncCallback callback);

        /// <summary>
        /// Gets the element with the specified id.
        /// </summary>
        /// <value>Returns the retrieved element.</value>
        DomainBase TryGetById(string id);

        #endregion

        #region Events

        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}